<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>

<!DOCTYPE html>
<html>
<head>
    <title>配送企业列表</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp" %>
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->    
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>配送企业列表</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li class="active"><a href="#">交易</a></li>
            <li class="active"><a href="#">配送企业列表</a></li>
        </ol>
    </section>

    <section class="content">
        <div class=" box box-success">
            <div class="box-body"  style="margin-top:-10px;">
            <form  id="exportExcel" method="post">
                <input id="fileName" name="fileName" type="hidden" value="<spring:message code="message.lable.compInfoxls"/>" />
                <div class="input">
                    <div class="textalign1"><spring:message code="message.listForm.qiYeMingCheng"/>：</div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="compName" name="compName" placeholder="<spring:message code="message.listForm.qiYeMingCheng"/>/<spring:message code="message.listForm.pinYinMa"/>"/>
                    </div>
                
                    <div hidden>
                         <div class="textalign"><spring:message code="message.listForm.qiYeBianMa"/>：</div>
		                 <div class="boxinput">
		                     <input type="text" class="textinput" id="compCode" name="compCode" placeholder="<spring:message code="message.listForm.qiYeBianMa"/>"/>
		                 </div>
                    </div>
                
                
                    <div class="textalign"><spring:message code="message.listForm.suoShuDiQu"/>：</div>
                    <div class="boxinput">
                        <table style="width:100%;">
                            <tr>
								<td style="width:33%">
								    <select class="textinput" id="area1" name="area1"></select>
								</td>
								<td style="width:33%">   
								    <select class="textinput" id="area2" name="area2"></select>
								</td>
								<td style="width:33%">
								    <select class="textinput" id="area3" name="area3">
								        <option value=''><spring:message code="message.select.option"/></option>
								    </select>
								</td>
                            </tr> 
                        </table>
						</div>
                    <div class="textalign" >
                        <button id="selectSEE" type="button" onclick="likeQuery();" class="btn btn-success btn-sm"><spring:message code="message.button.seachSpacing"/></button>
                    </div> 
                </div>
            </form>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
    </section>
   
    <%@ include file="/WEB-INF/component/commonJS.jsp" %>
   
    <script type="text/javascript">
    
	    
  
        $(function() {
        	
        	 //绑定回车
            $('#compName,#area1,#area2,#area3').bind('keydown', function(event) {
                if (event.keyCode == "13") {        //13 位电脑上回车键的位置代码
                    $('#selectSEE').click();
                }
            }); 
        	
        	$("#compName").focus();//加载页面光标在第一个查询框内
            
            $("#area1").HNSelect({
                url: "${pageContext.request.contextPath}/selectController/getArea.html", data: { ID: '000000' },  defaultText: "<option value=''><spring:message code="message.select.option"/></option>",
                func: function () {
                    $("#area2").HNSelect({
                        parent_selector: "#area1", url: "${pageContext.request.contextPath}/selectController/getArea.html", dataid: "ID",defaultText: "<option value=''><spring:message code="message.select.option"/></option>",
                                  func: function () {
                                      $("#area3").HNSelect({
                                          parent_selector: "#area2", url: "${pageContext.request.contextPath}/selectController/getArea.html", dataid: "ID", defaultText: "<option value=''><spring:message code="message.select.option"/></option>"
                                      });
                                  }
                    });
                }
            });
        	
           
              
            $("#gridlist").jqGrid({
                url : "getPsListByZX.html",
                mtype : "POST",
                datatype : "json",
                autowidth : true,
                shrinkToFit: true,
              //  height : 325,
                colNames : [ 
	                '<spring:message code="message.listForm.qiYeBianMa"/>', 
	                '<spring:message code="message.listForm.qiYeMingCheng"/>',
	                '<spring:message code="message.listForm.suoShuDiQu"/>', 
	                '<spring:message code="message.listForm.qiYeZhuCeLeiXing"/>',
	                '<spring:message code="message.listForm.zuZhiJiGouDaiMa"/>', 
	                '所属集团'
                ],
                colModel : [
                    {name : 'compCode',width : 180,align : "center",sortable : false,hidden:true},
                    {name : 'compName',width : 200,align : "center",sortable : false},
                    {name : 'areaName',width : 160,align : "center",sortable : false},
                    {name : 'regName',width : 120,align : "center",sortable : false,hidden:true},
                    {name : 'orgCode',width : 120,align : "center",sortable : false,hidden:true},
                    {name : 'groupName',width : 120,align : "center",sortable : false,hidden:true}
                ],
                rowNum : 20,
                rowList : [ 10, 20, 50,100 ],
                rownumbers : true,
                pager : "#gridpage",
                multiselect : false,
                viewrecords : true,
				gridComplete: function(){
					//序号列宽度自适应（参数为jqgridID）
					 autoRNWidth("gridlist");
					//数据只有一条时默认选中（参数为jqgridID）
					 selectByOneData("gridlist");
				 },
                /*gridComplete: function(){
                    var page = $("#gridlist").jqGrid('getGridParam','page');
                    var rows = $('#gridlist').getGridParam("rowNum");
                    var maxnum = (rows*page).toString();
                    var len = (maxnum.length)*10;
                    $('.jqgfirstrow').find('td').eq(0).css('width',len+'px');
                    $('#gridlist_rn').css('width',len+'px');
                },*/
                caption : "<spring:message code="message.list.compinfoStdlist"/>",
                jsonReader : {
                    repeatitems : false,
                    id : "compId"
                }
            });
        
            $("#gridlist").jqGrid('navGrid', '#gridpage', {add : false,edit : false,del : false,search : false,refresh : false});
            $(window).trigger("resize");
			$("#gridlist").jqGrid("setGridHeight",create());
        });
  
        //查询
        function likeQuery( page ) {
            var areaId = $("#area3").val();
            if( areaId == null || areaId == "" ){
                areaId = $("#area2").val();
            }
            if( areaId == null || areaId == "" ){
                areaId = $("#area1").val();
            }

            
            var compName = $.trim($("#compName").val());
        
            $("#gridlist").jqGrid('setGridParam',{
            	mtype: "POST",
                datatype:'json',
                postData: {
                    "areaId":areaId,
                    "compName":compName
                },
                page : page || 1
            }).trigger("reloadGrid");
        }
    </script>
</body>
</html>









